export type Menu = {
  _id: string,
  title: string,
  level: number,
  children: []
}

export type MenuList = Menu[];

export type Content = {
  _id: string, // ID
  title: string, // 工具标题名称
  content: string, // 工具图标
  statistics: {
    clickCount: number
    collectionCount: number
    forwardCount: number
    likeCount: number
    showCount: number
  },
  menus: {
    id: string,
    name: string,
  }[],
  // 用户相关状态属性
  isVote?: boolean,
  isCollection?: boolean,
}
export type ContentList = Content[];

export type UserInfo = {
  _id: string,
  name: string,
  contentVote?: string[],
  contentCollection?: string[],
  contentForward?: string[],
}

export interface ContentStateInterface {
  menu: {
    list: MenuList,
    isLoaded: boolean,
  },
  content: {
    list: ContentList
  },
  currentContent?: Content | null,
  contentVote: string[],
  contentCollection: string[],
}

function state (): ContentStateInterface {
  return {
    menu: {
      list: [],
      isLoaded: false
    },
    content: {
      list: []
    },
    currentContent: null,
    contentVote: [],
    contentCollection: []
  }
}

export default state
